package com.jhoncy.myproject.system.entity;

import com.jhoncy.myproject.common.dto.Entity;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.List;

/**
 * @author zhuangqi
 * @@date 2017/3/14.
 */
@Getter
@Setter
@Table(name = "sys_menu")
public class SysMenu extends Entity implements Comparable<SysMenu>{


    private static final long serialVersionUID = 5143167729625390889L;
    /** 菜单ID -- MENU_ID */
    @Id
    @Column(name = "MENU_ID")
    private String menuId;

    /** 菜单名称 -- MENU_NAME */
    @Column(name = "MENU_NAME")
    private String menuName;

    /** 菜单地址 -- MENU_URL */
    @Column(name = "MENU_URL")
    private String menuUrl;

    /** 父ID -- PARENT_ID */
    @Column(name = "PARENT_ID")
    private String parentId;

    /** 排序 -- MENU_ORDER */
    @Column(name = "MENU_ORDER")
    private Integer menuOrder;

    /** 菜单图标 -- MENU_ICON */
    @Column(name = "MENU_ICON")
    private String menuIcon;

    /** 菜单状态 -- MENU_TYPE */
    @Column(name = "MENU_TYPE")
    private Boolean menuType;

    @Transient
    private List<SysMenu> children = new ArrayList<>();

    @Override
    public int compareTo(SysMenu o) {
        return this.getMenuOrder()-o.getMenuOrder();
    }
}